package com.genreate.util.youdao;

import cn.hutool.core.util.ObjectUtil;


/**
 * 语言类型 枚举类
 *
 * @author LYS
 */
public enum LanguageTypeEnum {
    EN("en", "英语"),
    ZH("zh-CHS", "中文"),
    ;

    private final String code;

    private final String value;

    LanguageTypeEnum(String code, String value) {
        this.code = code;
        this.value = value;
    }

    public static LanguageTypeEnum getEnum(String code) {
        if (ObjectUtil.isEmpty(code)) {
            return null;
        }
        for (LanguageTypeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }


    public String getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

}
